# -*- coding:UTF-8 -*-

# 导入包
import muggle_ocr

# 初始化；model_type 包含了 ModelType.OCR/ModelType.Captcha 两种,OCR能识别中文
sdk = muggle_ocr.SDK(model_type=muggle_ocr.ModelType.OCR)

with open(r"img1.png", "rb") as f:
    b = f.read()
text = sdk.predict(image_bytes=b)
print(text)


# ModelType.Captcha 可识别4-6位验证码
sdk = muggle_ocr.SDK(model_type=muggle_ocr.ModelType.Captcha)
with open(r"img2.png", "rb") as f:
    b = f.read()
text = sdk.predict(image_bytes=b)
print(text)